<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/crs.css">
        <title>Organisator-Webseite</title>
    </head>
    <body>
        <span class="username">Benutzer: ${name}</span>
        
        <span class="roles">
            <form action="Main" method="POST">
                <select name="action" onchange="this.form.submit()">
                <c:forEach items="${roles}" var="role">
                        <option value="${role}" <c:if test="${fn:containsIgnoreCase(role, 'organizer')}">selected="true"</c:if>>${role}</option>
                    </c:forEach>
                </select>
            </form>
        </span>
        
        <form action="ConferenceAddingPage">
            <input type="submit" value="Konferenz anlegen">
        </form>
        
        <label>Reputation: ${reputation}</label>
        
        <form action="AssignRights">
            <input type="submit" value="Rechte vergeben"/>
        </form>        
        <div class="">
            
            <table border="1">
                <thead>
                    <tr>
                       <th>Konferenzname</th>
                       <th>Adresse</th>
                       <th>Datum</th>
                       <th>Rating</th>
                       <th>Max. Teilnehmer</th>
                       <th>angemeldete Teilnehmer</th>
                       <th>Anzahl eingereichte Paper</th>
                       <th>Aktion</th>
                    </tr>
                </thead>
                <tbody>
                <c:forEach items="${myConferenceList}" var="conference">
                    <tr>
                        <td>${conference.getTitle()}</td>
                        <td>${conference.getLocation()}</td>
                        <td>${conference.getDate()}</td>
                        <td>${conference.getReputation()}</td>
                        <td>${conference.getMaxParticipants()}</td>
                        <td>${conference.getParticipants().size()}</td>
                        <td>${conference.getPapers().size()}</td>
                        <td>
                            <form action="AssignPaper" method="POST">
                                <input type="hidden" name="conference" value="${conference.getTitle()}" />
                                <input type="submit" value="Paper zuordnen"/>
                            </form>
    
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
        
        <form action="LoginPage">
            <input type="hidden" name="action" value="logout"/>
            <input type="submit" value="Logout"/>
        </form>
    </body>
</html>
